@extends('layouts.header')
@section('style')
    .input-ip{
        -webkit-appearance: auto!important;
        text-align: center;
        width: 100px;
    }
    #passedcard_remote_ip-error{
        left: 91px;
        top: -16px;
    }
@endsection
@section('content')
    <article class="page-container">
        <form class="form form-horizontal" id="form" autocomplete="off" >
            <div class="row cl">
                <label class="form-label col-sm-3">合格证的检测公司名称：</label>
                <div class="formControls col-sm-9">
                    <input type="text" class="input-text" value="{{ $data->name_pass }}" placeholder="" name="name_pass">
                    <label style="color: #999!important;">/可换行</label>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">检测公司名称位置：</label>
                <div class="formControls col-sm-9">
                    <input type="text" class="input-text" value="{{ $data->passedcard_company_name_pos }}" placeholder="" name="passedcard_company_name_pos">
                    <label style="color: #999!important;">公司名称距左边沿的距离，单位：dot，12dot = 1mm</label>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">检测公司文字大小：</label>
                <div class="formControls col-sm-9">
                    <input type="text" class="input-text" value="{{$setSys['passedCard_company_name_font_size']}}" name="passedCard_company_name_font_size">
                    <label style="color: #999!important;">检测公司字符大小，单位：dot，12dot = 1mm</label>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">合格证的打印深度：</label>
                <div class="formControls col-sm-9">
                    <span class="select-box" style="width: 70px">
                        <select class="select" size="1" name="passedcard_print_depth">
                            @foreach ([3,4,5,6,7,8,9,10,11,12,13,14,15] as $item)
                                <option value="{{$item}}"
                                @if ($item === $data->passedcard_print_depth )
                                    selected
                                @endif >
                                {{$item}}
                                </option>
                            @endforeach
                        </select>
                    </span>
                    <label style="color: #999!important;">默认值：12，数值越大打印越清晰，但数值过大会影响打印头寿命</label>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">检测人员名称：</label>
                <div class="formControls col-sm-9 ">
                    <div class="radio-box">
                        <input type="radio" id="radio-1" name="passedcard_is_tester_code" value="0" @if ($data->passedcard_is_tester_code==0)checked @endif>
                        <label for="radio-1">真实姓名</label>
                      </div>
                      <div class="radio-box">
                        <input type="radio" id="radio-2" name="passedcard_is_tester_code" value="1" @if ($data->passedcard_is_tester_code==1)checked @endif>
                        <label for="radio-2">代号</label>
                      </div>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">检测人员数量：</label>
                <div class="formControls col-sm-9 ">
                    <div class="radio-box">
                        <input type="radio" id="radio-3" name="passedcard_tester_count" value="0" @if ($data->passedcard_tester_count==1)checked @endif>
                        <label for="radio-3">不限制</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" id="radio-3" name="passedcard_tester_count" value="1" @if ($data->passedcard_tester_count==1)checked @endif>
                        <label for="radio-3">1 人</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" id="radio-4" name="passedcard_tester_count" value="2" @if ($data->passedcard_tester_count==2)checked @endif>
                        <label for="radio-4">2 人</label>
                    </div>
                    <label style="color: #999!important;">合格证上的检测人员填写几个人</label>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">打印方式：</label>
                <div class="formControls col-sm-9 ">
                    <div class="radio-box">
                        <input type="radio" id="radio-7" name="passedcard_is_remote_print" value="2" @if ($data->passedcard_is_remote_print==2)checked @endif>
                        <label for="radio-7">打标机打印</label>
                        <label style="color: #999!important;margin-left:95px">生成合格证excel模板文件，选择后进行打印</label>
                    </div>
                    <br>
                    <div class="radio-box">
                        <input type="radio" id="radio-5" name="passedcard_is_remote_print" value="0" @if ($data->passedcard_is_remote_print==0)checked @endif>
                        <label for="radio-5">本机打印</label>
                        <label style="color: #999!important;margin-left:109px">只能用连接打印机的电脑打印</label>
                    </div>
                    <br>
                    <div class="radio-box">
                        <input type="radio" id="radio-6" name="passedcard_is_remote_print" value="1" @if ($data->passedcard_is_remote_print==1)checked @endif>
                        <label for="radio-6">远程打印</label>
                        <input type="text" class="input-ip" value="{{ $data->passedcard_remote_ip }}" placeholder="" name="passedcard_remote_ip">
                        <label style="color: #999!important;">与连接打印机的电脑在同一局域网即可打印</label>
                    </div>
                    <br><label style="color: rgb(216, 29, 29)!important;">选择远程打印时必须填写与打印机连接的电脑的IP地址<a href="https://jingyan.baidu.com/article/63f236287de2c70208ab3de4.html" target="_blank" class="btn btn-link">如何查看IP地址？</a></label>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">打印二维码：</label>
                <div class="formControls col-sm-9 ">
                    <div class="">
                        <label><input type="checkbox" name="passedCard_have_barcode" value="1" @if ($setSys['passedCard_have_barcode']==1)checked @endif> 开启</label>
                    </div>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">提前打印合格证：</label>
                <div class="formControls col-sm-9 ">
                    <label><input type="radio" name="passedCard_print_ahead" value="0" @if($setSys['passedCard_print_ahead'] == 0) checked @endif> 拒绝</label>
                    <label class="ml-10"><input type="radio" name="passedCard_print_ahead" value="1" @if($setSys['passedCard_print_ahead'] == 1) checked @endif> 允许</label>
                </div>
            </div>
            @csrf

            <div class="row cl pt-20">
                <div class="col-sm-9 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </article>
    <script type="text/javascript">
        $(function(){

            var index2;

            $("#form").validate({
                rules:{
                    passedcard_company_name_pos:{
                        required:true,
                        isPoInteger:true,
                        max:1000,
                    },
                    passedcard_remote_ip:{
                        ip:true,
                    },

                },
                // onkeyup:false,
                // focusCleanup:false,
                success:"valid",
                submitHandler:function(form){
                   $(form).ajaxSubmit({
                        type: 'post',
                        url: "",//自己提交给自己可以不写url
                        beforeSend : function () {
                            //0.4透明度 白色遮罩
                           index2 = layer.load(2,{ shade: [0.3,'#fff'] });
                        },
                        complete : function () {
                            layer.close(index2);
                        },
                        success: function(data) {
                            //判断添加结果
                            if(data === '1'){
                                parent.window.location.reload();//刷新
                                // parent.table_reload(0);//0停留在当前页，1回到第一页
                                parent.parent.layer.msg('操作成功!',{ icon: 1, time:2000 });
                                layer_close();
                            }else{
                                layer.msg('操作失败!', { icon: 2, time: 2000 });
                            }
                        },
                        error: function(data) {
                            ajax_error(data);
                        }
                    });
                }
            });
        });
    </script>
@endsection